package com.aracky.assess.schedule;

import com.aracky.assess.service.PushMsgService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import tech.powerjob.worker.core.processor.ProcessResult;
import tech.powerjob.worker.core.processor.TaskContext;
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;

import java.time.LocalDateTime;

/**
 * @Author zengzhiping
 * @BelongsPackage com.aracky.system.schedule
 * @CreateTime 2022-08-02
 * @Description 对发送失败的消息做一个重新发送--晚上凌晨发送
 */
@Component
public class SendFromRedisMsgJob implements BasicProcessor {
    private static Logger logger = LoggerFactory.getLogger(SendFromRedisMsgJob.class);

    @Autowired
    private PushMsgService pushMsgService;

    @Override
    public ProcessResult process(TaskContext taskContext) throws Exception {
        logger.info("wx msg start send：{}", LocalDateTime.now());

        pushMsgService.pushRedisMsg();

        return new ProcessResult(true, "msg send success" + LocalDateTime.now());
    }
}
